/**
 * @param {string} date
 * @return {string}
 */
var reformatDate = function (date) {
  // let DAYS = Array(31).map(item => item + 1 + 'th')
  let MONTH = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

  let [dd, mm, yy] = date.split(' ')
  if(MONTH.indexOf(mm)+1<10){
    mm = '0'+(MONTH.indexOf(mm)+1)
  }else{
    mm = MONTH.indexOf(mm)+1
  }
  if(dd.split('th')[0]<10){
    dd = '0'+dd.split('th')
  }else {
    dd = dd.split('th')
  }
  return yy+'-'+ mm+'-'+dd

};